package com.wenhui.schoolyardinfo.square.presenter;

import android.content.Context;

import com.wenhui.schoolyardinfo.login.presenter.base.BasePresenter;
import com.wenhui.schoolyardinfo.login.view.base.IBaseView;
import com.wenhui.schoolyardinfo.square.callback.OnSquareListener;
import com.wenhui.schoolyardinfo.square.model.SquareModelImpl;
import com.wenhui.schoolyardinfo.square.model.base.ISquareModel;
import com.wenhui.schoolyardinfo.square.presenter.base.ISquarePresenter;
import com.wenhui.schoolyardinfo.square.view.ISquareView;

import java.util.Map;

/**
 * author    : Urasaki
 * e-mail    : 1164688204@qq.com
 * date      : 2019/7/9 17:04
 * introduce : Presenter登录模块的（一个小模块对应一个Presenter）
 */

public class SquarePresenterImpl extends BasePresenter<IBaseView> implements ISquarePresenter {

    private static final String TAG = "MinePresenterImpl";
    //    private IMineView squareView;//P需要与V 交互，所以需要持有V的引用
    private ISquareModel squareModel;

    public SquarePresenterImpl(Context context, IBaseView baseView) {
        attachView(baseView);
        squareModel = new SquareModelImpl(context);
    }

    @Override
    public void getSquareData(Map<String, String> bodyParams) {
        if (getView() != null) {
            if (getView() instanceof ISquareView) {
                final ISquareView squareView = (ISquareView) getView();
                squareView.showLoading();
//                squareModel.getSquareData(bodyParams, new OnSquareListener(){
//                    @Override
//                    public void onSquareSuccess(String success) {
//                        squareView.getSquareDataSuccess(success);
//                        squareView.hideLoading();
//                    }
//
//                    @Override
//                    public void onSquareError(String error) {
//                        squareView.getSquareDataError(error);
//                        squareView.hideLoading();
//                    }
//                });
            }
        }
    }

}
